#include <stdio.h>
#include <string.h>
int main(){
    char buf[6]={0};
    FILE *fp = fopen("hello.txt", "r");
    if(fp == NULL){
        perror("open ");
        return -1;
    }

    int read;
    while((read = fread(buf, sizeof(char), 5, fp)) > 0){
        //末尾写\0保证%s可以输出
        buf[5] = '\0';
        printf("读取字节数%d,  读取数据为%s\n", read, buf); 
        //清空buf
        memset(buf,0,sizeof(buf));   
    }
    fclose(fp);
    return 0;
}